home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 November / Freeware November 1998.img / dist / fw_UDELxntp.idb / usr / freeware / src / xntp-3.4o-export / lib / modetoa.c.z / modetoa.c
C/C++ Source or Header  |  1998-01-21  |  484b  |  34 lines

  1. /*
  2.  * modetoa - return an asciized mode
  3.  */
  4. #include <stdio.h>
  5.  
  6. #include "lib_strbuf.h"
  7. #include "ntp_stdlib.h"
  8.  
  9. char *
  10. modetoa(mode)
  11.     int mode;
  12. {
  13.     char *bp;
  14.     static char *modestrings[] = {
  15.         "unspec",
  16.         "sym_active",
  17.         "sym_passive",
  18.         "client",
  19.         "server",
  20.         "broadcast",
  21.         "control",
  22.         "private",
  23.         "bclient",
  24.     };
  25.  
  26.     if (mode < 0 || mode >= (sizeof modestrings)/sizeof(char *)) {
  27.         LIB_GETBUF(bp);
  28.         (void)sprintf(bp, "mode#%d", mode);
  29.         return bp;
  30.     }
  31.  
  32.     return modestrings[mode];
  33. }
  34.